{% extends "base.html" %}
{% from "bootstrap/pagination.html" import render_pagination %}

{% block page_content %}
<div class="page-header">
  <div align="center"><h1>超级管理员</h1></div>
</div>
<div class="container">
  <div class="row" style='height: 440px; overflow-y :scroll; BORDER: 1px inset;'>
    <table class="table table-striped table-bordered" >
        {% if users %}
          <th width="10%" class='text-center'>用户</td>
          <th width="10%" class='text-center'>姓名</td>    
          <th width="10%" class='text-center'>权限</td>              
          <th width="10%" class='text-center'>操作</th>
          {% for user in users %}
          <tr>
            <td>{{ user.email }}</td>
            <td>{{ user.name }}</td>     
            <td>
              {% if user.isadmin== True %}管理员
              {% else %}不是管理员{% endif %}
            </td>            
            <td width="10%" >
                <div class="btn-group">
                  <button type="button" 
                    class="btn btn-warning dropdown-toggle" 
                    data-toggle="dropdown" aria-expanded="false">
                    权限管理
                    <span class="caret"></span>
                  </button>
                  <lu class="dropdown-menu dropdown-menu-right">
                    <li>
                      <a class="dropdown-item" 
                        href="{{ url_for('setadmin', userid=user.id) }}">
                        <span class="glyphicon glyphicon-ok"></span>
                        设为管理员
                      </a>
                    </li>
                    <li class="divider"></li>
                    <li>
                      <a class="dropdown-item" 
                        href="{{ url_for('notadmin', userid=user.id) }}">
                        <span class="glyphicon glyphicon-remove"></span>
                        取消管理员
                      </a>
                    </li>
                  </lu>
                </div>
            </td>
          </tr>
          {% endfor%}
        {% endif %}
      </table>
  </div>
  {% if users %}
    <div class="page-footer text-center">
      {{ render_pagination(pagination) }}
    </div>
  {% endif %}
</div>
{% endblock %}